package com.song.module.app.controller;


import com.song.common.result.R;
import com.song.module.admin.entity.ApCookbook;
import com.song.module.admin.request.ApUserBrowseRequest;
import com.song.module.admin.service.IApUserBrowseService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 浏览记录控制层
 *
 * @author song
 * @date 2024-03-05
 */
@Slf4j
@AllArgsConstructor
@RestController
@Api(value = "浏览记录接口管理", tags = "浏览记录接口管理")
@RequestMapping("/app/apUserBrowse")
public class AppUserBrowseController {

    private final IApUserBrowseService iApUserBrowseService;

    /**
     * 分页查询浏览记录列表
     */
    @ApiOperation(value = "分页查询浏览记录列表")
    @PostMapping("/list")
    public R<List<ApCookbook>> pageList(@RequestBody ApUserBrowseRequest apUserBrowseRequest) {
        return R.success(iApUserBrowseService.browseRecord(apUserBrowseRequest));
    }

    /**
     * 分页查询浏览记录列表
     */
    @ApiOperation(value = "分页查询浏览记录列表")
    @PostMapping("/clear")
    public R<String> clearList(@RequestBody ApUserBrowseRequest apUserBrowseRequest) {
        iApUserBrowseService.clearBrowseRecord(apUserBrowseRequest);
        return R.success("success");
    }


}
